package cn.wolfcode.trip.admin.controller;


import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.query.TravelQuery;
import cn.wolfcode.trip.base.service.ITravelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/travelRelease")
public class ReleaseTravelController {
    @Autowired
    private ITravelService travelService;
    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") TravelQuery qo){
        //已发布
        qo.setState(Travel.STATE_RELEASE);
        //公开
        qo.setIsPublic(true);
        //发布时间倒序
        qo.setOrderBy("t.releaseTime desc");
        model.addAttribute("pageInfo",travelService.query(qo));
        return "/travel/release";
    }
}
